Skip to content

update(heatmap-basic): seaborn — comprehensive quality review#4253

Merged
github-actions[bot] merged 5 commits intomainfrom
implementation/heatmap-basic/seaborn
Feb 15, 2026
Merged

update(heatmap-basic): seaborn — comprehensive quality review#4253
github-actions[bot] merged 5 commits intomainfrom
implementation/heatmap-basic/seaborn

Conversation

@MarkusNeusinger
Copy link
Copy Markdown
Owner

Summary

Updated seaborn implementation for heatmap-basic.

Changes: Comprehensive quality review — fix weaknesses from prior reviews, preserve strengths, improve quality across all dimensions.

Changes

  • Addressed review weaknesses from prior quality assessment
  • Improved data choice and visual design
  • Enhanced library-specific feature usage
  • Updated to current library and Python versions
  • Quality self-assessment: pending CI review

Test Plan

  • Preview images uploaded to GCS staging
  • Implementation file passes ruff format/check
  • Metadata YAML updated with current versions
  • Automated review triggered

Generated with Claude Code /update command

Copilot AI review requested due to automatic review settings February 15, 2026 21:27
Comprehensive quality review: fix weaknesses from prior reviews, preserve strengths, improve quality across all dimensions.
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Feb 15, 2026

AI Review - Attempt 1/3

Image Description

The plot displays a clustered heatmap of monthly department performance scores (0-100) for seven departments (Sales, Finance, Engineering, Operations, Marketing, Support, HR) across twelve months (Jan-Dec). A diverging blue-to-red colormap is used, centered at 50 — blue indicates low scores, red indicates high scores. Each cell contains a white-text integer annotation of the performance value. A dendrogram on the left groups departments by similarity via hierarchical row-clustering (columns are not clustered). A vertical colorbar on the right is labeled "Performance Score" with a 0-100 range. White gridlines separate each cell. The title "heatmap-basic · seaborn · pyplots.ai" appears at the top center. The X-axis is labeled "Month" and department names appear on the right Y-axis. Clear patterns are visible: Sales strong first half fading later, Engineering strong second half, Finance consistently high (~80-90), HR with lower scores mid-year.

Quality Score: 82/100

Criteria Checklist

Visual Quality (24/30)

  • VQ-01: Text Legibility (8/8) - All font sizes explicitly set: title 24pt, xlabel 20pt, ticks 16pt, annotations 14pt
  • VQ-02: No Overlap (6/6) - No overlapping text anywhere
  • VQ-03: Element Visibility (5/6) - Annotations readable; could be slightly larger for cell size
  • VQ-04: Color Accessibility (3/4) - Custom diverging blue-red palette is functional but not a standard colorblind-safe option like RdBu_r or coolwarm
  • VQ-05: Layout Balance (3/4) - Decent layout; dendrogram and colorbar well-placed but some wasted vertical space
  • VQ-06: Axis Labels & Title (1/2) - X-axis labeled "Month" but Y-axis label is empty string — missing "Department" label

Design Excellence (12/20)

  • DE-01: Aesthetic Sophistication (6/8) - Clustermap with custom diverging palette, white gridlines, and hierarchical clustering shows design thought clearly above defaults
  • DE-02: Visual Refinement (4/6) - White cell gridlines, custom colorbar placement, controlled dendrogram ratio; some defaults remain
  • DE-03: Data Storytelling (4/6) - Injected patterns create a story: Sales strong early, Engineering strong late, Finance stable, HR dip mid-year. Clustering groups similar departments visually

Spec Compliance (14/15)

  • SC-01: Plot Type (5/5) - Correct heatmap type via seaborn clustermap
  • SC-02: Required Features (4/4) - Diverging colormap, cell annotations, colorbar legend, logical row ordering via clustering
  • SC-03: Data Mapping (3/3) - Departments as rows, months as columns, performance scores as values
  • SC-04: Title & Legend (2/3) - Title format correct; colorbar serves as legend. Y-axis label absent

Data Quality (14/15)

  • DQ-01: Feature Coverage (5/6) - Shows variation, patterns, clustering — but could include more extreme outliers
  • DQ-02: Realistic Context (5/5) - Genuine business scenario: department performance by month
  • DQ-03: Appropriate Scale (4/4) - Performance scores 5-95 are realistic

Code Quality (9/10)

  • CQ-01: KISS Structure (3/3) - Clean imports → data → plot → save flow
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) set
  • CQ-03: Clean Imports (2/2) - Only matplotlib, numpy, seaborn imported
  • CQ-04: Code Elegance (1/2) - Manual ScalarMappable colorbar after setting cbar_pos=None is slightly verbose
  • CQ-05: Output & API (1/1) - Saves as plot.png, no deprecated functions

Library Mastery (9/10)

  • LM-01: Idiomatic Usage (4/5) - Good use of sns.clustermap and sns.diverging_palette; manual colorbar handling is less idiomatic
  • LM-02: Distinctive Features (5/5) - sns.clustermap with hierarchical clustering is a distinctive seaborn feature not easily replicated elsewhere

Strengths

  • Excellent use of sns.clustermap for hierarchical row-clustering, showcasing a distinctive seaborn capability
  • Well-crafted synthetic data with intentional patterns that create a meaningful story (Sales strong early, Engineering strong late, Finance stable)
  • All font sizes explicitly set with good readability at target resolution
  • Realistic business context with sensible performance score range

Weaknesses

  • Missing Y-axis label ("Department") — the ylabel is set to empty string
  • Manual colorbar creation via ScalarMappable after disabling built-in cbar (cbar_pos=None) is unnecessarily verbose — could use the built-in colorbar support
  • Custom diverging palette via sns.diverging_palette(240, 10) is not a standard colorblind-safe colormap — consider using RdBu_r or coolwarm for better accessibility
  • Could push design further: no spine removal, no background color refinement, annotation font could be larger

Verdict: REJECTED

@github-actions github-actions Bot added quality:82 Quality score 82/100 ai-rejected Quality not OK, triggers update labels Feb 15, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels Feb 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the seaborn implementation of the heatmap-basic specification to address weaknesses from prior quality reviews. The changes include updating library versions, modifying the specification to add a "matrix" data type tag and revise ordering guidelines, and significantly refactoring the implementation to use hierarchical clustering.

Changes:

  • Updated specification.yaml with new timestamp and added "matrix" data type tag
  • Modified specification.md to change clustering guidance to logical ordering guidance
  • Switched implementation from sns.heatmap() to sns.clustermap() with row clustering enabled
  • Updated metadata to Python 3.14.3, claude-opus-4-6, with quality score pending review

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
plots/heatmap-basic/specification.yaml Added "matrix" data type tag and updated timestamp
plots/heatmap-basic/specification.md Changed guidance from clustering to logical ordering
plots/heatmap-basic/metadata/seaborn.yaml Updated versions (Python 3.14.3, claude-opus-4-6) and nullified quality score
plots/heatmap-basic/implementations/seaborn.py Replaced sns.heatmap() with sns.clustermap(), added hierarchical clustering

@@ -1,7 +1,7 @@
""" pyplots.ai
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header docstring format is inconsistent with the codebase convention. Most implementations use a space after the opening triple quotes. This should be """ pyplots.ai not """pyplots.ai.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to 47
# Plot - clustermap groups similar departments via hierarchical clustering
cmap = sns.diverging_palette(240, 10, as_cmap=True)
g = sns.clustermap(
data,
annot=True,
fmt=".0f",
cmap="RdBu",
cmap=cmap,
center=50,
xticklabels=months,
yticklabels=departments,
linewidths=1,
linecolor="white",
cbar_kws={"label": "Performance Score", "shrink": 0.75},
annot_kws={"fontsize": 16},
ax=ax,
annot_kws={"fontsize": 14},
figsize=(16, 10),
row_cluster=True,
col_cluster=False,
dendrogram_ratio=0.08,
cbar_pos=None,
vmin=0,
vmax=100,
)
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sns.clustermap() with hierarchical clustering is inappropriate for a "basic" heatmap specification. The specification for heatmap-basic asks for a simple matrix heatmap with logical ordering (alphabetical, by magnitude, or by similarity), not hierarchical clustering with dendrograms. Clustering functionality is the defining feature of the separate heatmap-clustered specification. This implementation should use sns.heatmap() instead, similar to the matplotlib implementation and the heatmap-correlation seaborn implementation. The current approach violates the principle that each specification should demonstrate a distinct plot type.

Copilot uses AI. Check for mistakes.
Comment on lines 49 to 53
# Colorbar with proper placement
sm = plt.cm.ScalarMappable(cmap=cmap, norm=plt.Normalize(0, 100))
cbar = g.fig.colorbar(sm, ax=g.ax_heatmap, location="right", shrink=0.7, pad=0.12)
cbar.set_label("Performance Score", fontsize=18)
cbar.ax.tick_params(labelsize=14)
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The manual colorbar creation is unnecessarily complex when using clustermap. However, if switching to sns.heatmap() as recommended, this entire colorbar section would be handled automatically by the heatmap function's cbar_kws parameter, similar to the pattern used in heatmap-correlation seaborn implementation.

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +60
# Style
g.ax_heatmap.set_xlabel("Month", fontsize=20)
g.ax_heatmap.set_ylabel("")
g.ax_heatmap.tick_params(axis="x", labelsize=16)
g.ax_heatmap.tick_params(axis="y", labelsize=16, rotation=0)
g.fig.suptitle("heatmap-basic · seaborn · pyplots.ai", fontsize=24, y=1.02)
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The styling code references clustermap-specific attributes (g.ax_heatmap, g.fig.suptitle). When switching to sns.heatmap() as recommended, this should be simplified to use the standard matplotlib ax.set_xlabel(), ax.set_ylabel(), ax.set_title() pattern seen in the heatmap-correlation implementation.

Copilot uses AI. Check for mistakes.
Attempt 1/3 - fixes based on AI review
@github-actions
Copy link
Copy Markdown
Contributor

🔧 Repair Attempt 1/3

Applied fixes based on AI review feedback.

Status: Repair completed, re-triggering review...


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Feb 15, 2026

AI Review - Attempt 2/3

Image Description

The plot displays a clustered heatmap showing monthly performance scores (0–100) across 7 departments (Sales, Finance, Engineering, Operations, Marketing, Support, HR). A coolwarm diverging colormap is used, centered at 50 — red cells indicate high performance, blue cells low performance. Each cell contains a white numeric annotation showing the exact score. A row dendrogram on the left groups departments by similarity via hierarchical clustering (columns are not clustered). The colorbar on the far left is labeled "Performance Score" with ticks at 0, 25, 50, 75, 100. Axis labels read "Month" (x-axis) and "Department" (y-axis, on right side). The title "heatmap-basic · seaborn · pyplots.ai" appears at the top. The background is a subtle off-white (#fafafa), cells are separated by white gridlines, and spines are removed for a clean look. Clear patterns are visible: Sales is strong in the first half, Engineering ramps up in the second half, Finance is consistently high (~80–91), and HR shows a mid-year dip.

Quality Score: 92/100

Criteria Checklist

Visual Quality (28/30)

  • VQ-01: Text Legibility (8/8) - All font sizes explicitly set: title 24pt, axis labels 20pt, ticks 16pt, annotations 16pt. All perfectly readable
  • VQ-02: No Overlap (6/6) - No overlapping text anywhere; annotations fit cleanly within cells
  • VQ-03: Element Visibility (6/6) - Cell sizes well-proportioned for a 7×12 matrix; colors and annotations clearly distinguishable
  • VQ-04: Color Accessibility (3/4) - Coolwarm diverging palette is acceptable but not optimal for deuteranopia; not a red-green issue though
  • VQ-05: Layout Balance (3/4) - Good canvas utilization; minor issue with dendrogram and colorbar taking space on the left, Department label on the far right
  • VQ-06: Axis Labels & Title (2/2) - "Month", "Department", "Performance Score" are descriptive and appropriate for this context

Design Excellence (15/20)

  • DE-01: Aesthetic Sophistication (6/8) - Customized colorbar position, facecolor refinement, white cell borders, spine removal, dendrogram styling — clearly above defaults
  • DE-02: Visual Refinement (5/6) - Spines removed, subtle #fafafa background, white linewidths, dendrogram custom facecolor, medium fontweight annotations
  • DE-03: Data Storytelling (4/6) - Data patterns are intentional and visible (Sales first-half, Engineering second-half, Finance stability, HR dip); clustering groups similar departments

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Correct heatmap using seaborn's clustermap variant
  • SC-02: Required Features (4/4) - Diverging colormap ✓, cell annotations ✓, colorbar legend ✓, logical row ordering via clustering ✓
  • SC-03: Data Mapping (3/3) - X=months (columns), Y=departments (rows), values mapped to color intensity
  • SC-04: Title Format (3/3) - "heatmap-basic · seaborn · pyplots.ai" correct; colorbar serves as legend

Data Quality (14/15)

  • DQ-01: Feature Coverage (5/6) - Shows variation, patterns, high/low values, and clustering; could show a few more extreme outlier patterns
  • DQ-02: Realistic Context (5/5) - Monthly department performance metrics — plausible business scenario with real department names
  • DQ-03: Appropriate Scale (4/4) - Performance scores 5–95 are realistic for a 0–100 metric

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Clean Imports → Data → Plot → Save flow, no functions/classes
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) set
  • CQ-03: Clean Imports (2/2) - Only matplotlib.pyplot, numpy, seaborn — all used
  • CQ-04: Code Elegance (2/2) - Appropriate complexity, intentional data patterns, clean organization
  • CQ-05: Output & API (1/1) - Saves as plot.png with dpi=300, bbox_inches='tight'

Library Mastery (10/10)

  • LM-01: Idiomatic Usage (5/5) - Expert use of sns.clustermap with annot, fmt, cmap, center, cbar_kws, cbar_pos, dendrogram_ratio
  • LM-02: Distinctive Features (5/5) - sns.clustermap integrates hierarchical clustering + heatmap + dendrogram — a feature unique to seaborn that would require significant manual work in other libraries

Strengths

  • Excellent use of sns.clustermap — a distinctive seaborn feature that integrates hierarchical clustering with heatmap visualization
  • Intentional data patterns (Sales first-half, Engineering second-half, Finance stability, HR mid-year dip) create genuine visual storytelling
  • Strong visual refinement: custom colorbar positioning, spine removal, #fafafa background, white cell borders, and styled dendrogram
  • All font sizes explicitly set and well-calibrated for the output resolution
  • Clean, well-organized code following KISS principles

Weaknesses

  • Coolwarm colormap could be replaced with a more colorblind-friendly diverging palette (e.g., RdBu or a custom perceptually-uniform option)
  • The Department axis label appears on the far right due to clustermap layout, slightly detached from the row labels
  • Data patterns could be slightly more varied — an additional extreme outlier or department with a sharp trend reversal would better demonstrate the heatmap's full potential

Verdict: APPROVED

@github-actions github-actions Bot added quality:92 Quality score 92/100 ai-approved Quality OK, ready for merge labels Feb 15, 2026
Copilot AI review requested due to automatic review settings February 15, 2026 21:38
@MarkusNeusinger MarkusNeusinger review requested due to automatic review settings February 15, 2026 21:38
Copilot AI review requested due to automatic review settings February 15, 2026 21:38
@MarkusNeusinger MarkusNeusinger review requested due to automatic review settings February 15, 2026 21:38
@github-actions github-actions Bot merged commit 8996606 into main Feb 15, 2026
3 checks passed
@github-actions github-actions Bot deleted the implementation/heatmap-basic/seaborn branch February 15, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-approved Quality OK, ready for merge ai-attempt-1 First repair attempt quality:82 Quality score 82/100 quality:92 Quality score 92/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants